package org.csmzxy.class2333;
//设备控制器类
class DeviceController {
    private String controllerName; //设备控制器名称
    public DeviceController(String controllerName) {
        this.controllerName = controllerName;
    }
    //设备控制器连接设备的方法
    public void connectToDevice() {
        System.out.println("设备控制器成功连接到设备");
    }
    //设备成员内部类
    class Device {
        private String deviceName; //定义设备名称
        public Device(String deviceName) {
            this.deviceName = deviceName;
        }
        //设备开机方法
        public void powerOn() {
            System.out.println(controllerName + "控制" + deviceName + "开机！");
        }
        //设备关机方法
        public void powerOff() {
            System.out.println(controllerName + "控制" + deviceName + "关机！");
        }
    }
}
public class example16 {
    public static void main(String[] args) {
        DeviceController controller = new DeviceController("设备控制器");
        controller.connectToDevice();
        DeviceController.Device device = controller.new Device("设备1");
        device.powerOn();
        device.powerOff();
    }
}
